home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-07-07 | 4.2 KB | 192 lines | [TEXT/ALFA] |
- #=============================================================================
- # Window handling routines. All procs are bound in AlphaBits.tcl.
- #=============================================================================
-
- proc shrinkHigh {} {
- global tileTop
- set text [getGeometry]
- set left [lindex $text 0]
- set top [lindex $text 1]
- set width [lindex $text 2]
- sizeWin $width 150
- moveWin $left $tileTop
- }
-
- proc shrinkLow {} {
- set text [getGeometry]
- set left [lindex $text 0]
- set top [lindex $text 1]
- set width [lindex $text 2]
- moveWin $left 315
- sizeWin $width 146
- }
-
-
- proc swapWithNext {} {
- set files [winNames -f]
- set len [llength $files]
- if {$len <= 1} return
- bringToFront [lindex $files 1]
- }
-
- proc nextWindow {} {
- set files [winNames -f]
- if {[llength $files] <= 1} return
- sendToBack [lindex $files 0]
- }
-
- proc prevWindow {} {
- set files [winNames -f]
- set len [llength $files]
- if {$len <= 1} return
- bringToFront [lindex $files [expr $len-1]]
- }
-
- proc dispFullName {} {
- message [lindex [winNames -f] 0]
- }
-
- proc vertically {} {
- global tileHeight tileTop tileWidth
- global numWinsToTile
- set margin 22
- set names [winNames -f]
- set numWins [llength $names]
- if ($numWins<=1) return
- if ($numWins>$numWinsToTile) {set numWins $numWinsToTile}
- set height [expr ($tileHeight/$numWins)-$margin]
- set height [expr {$height + $margin / $numWins}]
- set width $tileWidth
- set ver $tileTop
- if {$numWins == 0} {return}
-
- for {set i 0} {$i < $numWins} {incr i} {
- moveWin [lindex $names $i] 1000 0
- sizeWin [lindex $names $i] $width $height
- }
-
- for {set i 0} {$i < $numWins} {incr i} {
- moveWin [lindex $names $i] 3 $ver
- set ver [expr $ver+$margin+$height]
- }
- }
-
- proc horizontally {} {
- global tileHeight tileWidth tileTop numWinsToTile
-
- set names [winNames -f]
- set numWins [llength $names]
- if ($numWins<=1) return
- if ($numWins>$numWinsToTile) {set numWins $numWinsToTile}
- set margin 4
- set width [expr ($tileWidth/$numWins)-$margin]
- set width [expr {$width + $margin / $numWins}]
- set height $tileHeight
- set hor 0
- if {$numWins == 0} {return}
-
- for {set i 0} {$i < $numWins} {incr i} {
- moveWin [lindex $names $i] 1000 0
- sizeWin [lindex $names $i] $width $height
- }
-
- for {set i 0} {$i < $numWins} {incr i} {
- moveWin [lindex $names $i] $hor $tileTop
- set hor [expr $hor+$width+$margin]
- }
- }
-
- proc tiled {} {
- global tileHeight tileWidth numWinsToTile tileTop
- set xPan 8
- set yPan 10
- set xMarg 3
- set yMarg $tileTop
- set yMax 50
- set names [winNames -f]
- set numWins [llength $names]
- if ($numWins<1) return
- set line 0
- set height [expr $tileHeight-$yPan*($numWins-1)]
- set width [expr $tileWidth-$xPan*($numWins-1)]
-
- for {set i 0} {$i < $numWins} {incr i} {
- moveWin [lindex $names $i] [expr $xMarg+$i*$xPan] [expr $yMarg+$line]
- set line [expr $line+$yPan]
- if ($line>$yMax) {set line 0}
- sizeWin [lindex $names $i] $width $height
- }
- }
-
-
- proc overlay {} {
- global defHeight defWidth numWinsToTile tileTop
- set names [winNames -f]
- set numWins [llength $names]
- if ($numWins<1) return
- for {set i 0} {$i < $numWins} {incr i} {
- moveWin [lindex $names $i] 3 $tileTop
- sizeWin [lindex $names $i] $defWidth $defHeight
- }
- }
-
-
- proc threeQuarters {} {
- global tileHeight tileWidth tileTop
-
- if {[llength [set nms [winNames -f]]] <= 2} return
- set one [lindex $nms 0]
- set two [lindex $nms 1]
- set margin 22
- set height [expr ($tileHeight - $margin) / 4]
-
- moveWin $one 1000 0
- sizeWin $one $tileWidth [expr 3 * $height]
- moveWin $two 1000 0
- sizeWin $two $tileWidth $height
-
- set ver $tileTop
- moveWin $one 3 $ver
- moveWin $two 3 [expr $ver + 3 * $height + $margin]
- }
- bind '3' <Q> threeQuarters
-
-
- proc chooseAWindow {} {
- set name [listpick [lsort -ignore [winNames]]]
- if {[string length $name]} {
- bringToFront $name
- if [icon -q] { icon -f $name -o }
- }
- }
-
-
- proc iconify {} {
- icon -t
- }
-
-
-
- proc zoom {} {
- global nzmState tileHeight tileWidth zoomedGeo tileTop
-
- set win [lindex [winNames -f] 0]
- if {[info exists nzmState($win)]} {
- if {[getGeometry] == $zoomedGeo} {
- set state $nzmState($win)
- moveWin [lindex $state 0] [lindex $state 1]
- sizeWin [lindex $state 2] [lindex $state 3]
- unset nzmState($win)
- return
- }
- }
-
- set nzmState($win) [getGeometry]
- moveWin 3 $tileTop
- sizeWin $tileWidth $tileHeight
-
- if {![info exists zoomedGeo]} {
- set zoomedGeo [getGeometry]
- }
- }
-